package vip.liux.front.domain.models.payment;


import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.Objects;

@Setter
@Getter
@Embeddable
public class PaymentRequestProductId implements Serializable {
    @Column(name = "payment_request_id")
    private String paymentRequestId;

    @Column(name = "code")
    private String code;

    // Default constructor
    public PaymentRequestProductId() {
    }

    // Parameterized constructor
    public PaymentRequestProductId(String paymentRequestId, String code) {
        this.paymentRequestId = paymentRequestId;
        this.code = code;
    }

    // Override equals and hashCode
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        PaymentRequestProductId that = (PaymentRequestProductId) o;
        return Objects.equals(paymentRequestId, that.paymentRequestId) && Objects.equals(code, that.code);
    }

    @Override
    public int hashCode() {
        return Objects.hash(paymentRequestId, code);
    }
}